class RequestAndComplaint::RegistrationRequestStatesController < ApplicationController
  # GET /request_and_complaint/registration_request_states
  # GET /request_and_complaint/registration_request_states.xml
  def index
    @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_states = RequestAndComplaint::RegistrationRequestState.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @request_and_complaint_registration_request_states }
    end
  end

  # GET /request_and_complaint/registration_request_states/1
  # GET /request_and_complaint/registration_request_states/1.xml
  def show
    @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_state = RequestAndComplaint::RegistrationRequestState.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @request_and_complaint_registration_request_state }
    end
  end

  # GET /request_and_complaint/registration_request_states/new
  # GET /request_and_complaint/registration_request_states/new.xml
  def new
    @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_state = RequestAndComplaint::RegistrationRequestState.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @request_and_complaint_registration_request_state }
    end
  end

  # GET /request_and_complaint/registration_request_states/1/edit
  def edit
     @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_state = RequestAndComplaint::RegistrationRequestState.find(params[:id])
  end

  # POST /request_and_complaint/registration_request_states
  # POST /request_and_complaint/registration_request_states.xml
  def create
     @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_state = RequestAndComplaint::RegistrationRequestState.new(params[:request_and_complaint_registration_request_state])

    respond_to do |format|
      if @request_and_complaint_registration_request_state.save
        format.html { redirect_to(@request_and_complaint_registration_request_state, :notice => 'Registration request state was successfully created.') }
        format.xml  { render :xml => @request_and_complaint_registration_request_state, :status => :created, :location => @request_and_complaint_registration_request_state }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @request_and_complaint_registration_request_state.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /request_and_complaint/registration_request_states/1
  # PUT /request_and_complaint/registration_request_states/1.xml
  def update
     @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_state = RequestAndComplaint::RegistrationRequestState.find(params[:id])

    respond_to do |format|
      if @request_and_complaint_registration_request_state.update_attributes(params[:request_and_complaint_registration_request_state])
        format.html { redirect_to(@request_and_complaint_registration_request_state, :notice => 'Registration request state was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @request_and_complaint_registration_request_state.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /request_and_complaint/registration_request_states/1
  # DELETE /request_and_complaint/registration_request_states/1.xml
  def destroy
     @title_view = 'Estados de Solicitud de Registro'
    @request_and_complaint_registration_request_state = RequestAndComplaint::RegistrationRequestState.find(params[:id])
    mensaje = @request_and_complaint_registration_request_state.erasable
    if mensaje.blank?
      @request_and_complaint_registration_request_state.deleted = 1
      @request_and_complaint_registration_request_state.save
    end
    respond_to do |format|
      format.html { redirect_to(request_and_complaint_registration_request_states_url, :notice => mensaje) }
      format.xml  { head :ok }
    end
  end
end
